#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cmath>
using namespace std;
int arr[1000000] = { 0 }; int s[100000] = { 0 }, c[100000] = { 0 };	int n = 0; int i = 1;
int com(const void* n, const void* m)
{
	return *(int*)n - *(int*)m;
}
void No()
{
	cout << "NO" << endl;
}
void Yes()
{
	cout << "YES" << endl;
	arr[n + 1] = s[i];
	n++;
	qsort(arr, n + 1, sizeof(int), com);
}
int main()
{
	cin >> n;

	for (int j = 1; j <= n; j++)
		cin >> arr[j];
	int m = 0;
	cin >> m;
	for (int j = 1; j <= m; j++)
	{
		cin >> s[j];
		cin >> c[j];
	}
	qsort(arr, n + 1, sizeof(int), com);
	for (i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n - 1; j++)
		{
			if (s[i] > arr[j] && s[i] <= arr[j + 1])
			{
				if (j + 1 <= c[i])
				{
					Yes();
					break;
				}
				else
				{
					No();
					break;
				}
			}
			else if (s[i] == arr[j])
			{
				if (j <= c[i])
				{
					Yes();
					break;
				}
				else
				{
					No();
					break;
				}
			}

			else if (s[i] <= arr[1])
			{
				if (c[i] >= 1)
				{
					Yes();
					break;
				}
				else
				{
					No();
					break;
				}
			}
			else if (s[i] > arr[n])
			{
				if (c[i] >= n + 1)
				{
					Yes();
					break;
				}
				else
				{
					No();
					break;
				}
			}
			else if (s[i] == arr[n])
			{
				if (c[i] >= n && arr[n - 1] != arr[n])
				{
					Yes();
					break;
				}
				else if (arr[n - 1] == arr[n])
					continue;
				else
				{
					No();
					break;
				}
			}
			else
			{

			}
		}
	}
	for (int k = 1; k <= n; k++)
		cout << arr[k] << " ";
	return 0;
}